define(['jq'],()=>{
    class List {
        constructor() {
            this.ul = document.querySelector('.list5>ul')
            console.log(this.ul)
            this.listbox = document.querySelector('.list5')
       
            this.request()
        
    
        }
      
        request() {
            $.ajax({
                url: './data/goods.json',   // 必填，请求的地址 （获取这里填获取数据的地址）
                type: 'GET',   // 选填，请求方式，默认是 GET（忽略大小写）
            
               
               
            }).then(res=>{
               
                // console.log(res)
                var data=res.result[1].goods
                // console.log(data)
                this.render(data)
            })

        }
        render(data) {
            data.forEach((item) => {
                this.ul.innerHTML += `
                <li>
             
                <div class="pic">
                    <img src="${item.picture}">
                </div>
                <p class="name hide">${item.name}</p>
                <p class="desc hide">${item.desc}</p>
         
                <p class="price">￥${item.price}</p>
     
            </li> 
                `
            })
            this.listbox.onmouseover = (e) => {

                let target = e.target || e.scrElement
                if (target.nodeName == 'IMG') {
                    target.className = 'animate__animated animate__pulse'

                }
            }
            this.listbox.onmouseout = function (e) {
                let target = e.target || e.scrElement
                if (target.nodeName == 'IMG') {
                    target.className = ''

                }
            }
        }
    }
    new List()
  
});